package com.dingqb.myapplication.paint.bezier;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;

/**
 * 贝济埃曲线
 */
public class BezierCurve extends View {
    public BezierCurve(Context context) {
        super(context);
    }

    public BezierCurve(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public BezierCurve(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        Paint paint = new Paint();
        paint.setColor(Color.RED);
        Path path = new Path();
        path.moveTo(100, 300);
        path.quadTo(200, 200, 300, 300);
        //path.quadTo(400, 400, 500, 500);
        canvas.drawPath(path, paint);

    }
}
